package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.OrganizationService;
import com.yixun.qfbao.apidto.GetOrgAssistantListReqDto;
import com.yixun.qfbao.apidto.GetOrgAssistantListResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetOrgAssistantListReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GetOrgAssistantListHander extends CommonAbstractHander {
    private static Logger logger= LoggerFactory.getLogger(GetOrgAssistantListHander.class);
    @Autowired
    private OrganizationService organizationService;
    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        GetOrgAssistantListReqVo req = (GetOrgAssistantListReqVo)reqDto;
        GetOrgAssistantListReqDto getOrgAssistantListReqDto = req.getParams();
        BaseResponseDTO<GetOrgAssistantListResDto> res = new BaseResponseDTO<GetOrgAssistantListResDto>();
        GetOrgAssistantListResDto resDto = new GetOrgAssistantListResDto();
        try{
            resDto = organizationService.getOrgAssistantList(getOrgAssistantListReqDto);
            res.setResult(resDto.getResult());
            res.setResData(resDto);
        }catch (Exception e){
            logger.error("GetOrgAssistantListHander error: {}", e);
            res.setResult(ResultEnum.FAIL.getNo());
            res.setErrorMsg("获取机构失败");
        }
        return res;
    }
}
